#ifndef __CC_TIMER__
#define __CC_TIMER__
#include "cc_portable.h"

#define cc_timer_get_data(data) pvTimerGetTimerID(data)

#define cc_timer_auto_reload cc_true
#define cc_timer_one_shot    cc_false

void cc_timer_init(cc_timer_t timer, cc_timer_cb fun, uint8_t type, uint32_t ms, void* data);
cc_timer_t cc_timer_create(cc_timer_cb fun, uint8_t type, uint32_t ms, void* data);
cc_timer_t cc_timer_create_and_start(cc_timer_cb fun, uint8_t type, uint32_t ms, void* data);
cc_timer_t cc_timer_init_and_start(cc_timer_t timer, cc_timer_cb fun, uint8_t type, uint32_t ms, void* data);
int cc_timer_reset(cc_timer_t tim);
int cc_timer_start(cc_timer_t tim);
int cc_timer_stop(cc_timer_t tim);
int cc_timer_change_time(cc_timer_t tim, uint32_t ms);
int cc_timer_change_time_and_start(cc_timer_t tim, uint32_t ms);
int cc_timer_change_time_and_stop(cc_timer_t tim, uint32_t ms);
int cc_timer_set_mode(cc_timer_t tim, int mode);
int cc_timer_set_mode_start(cc_timer_t tim, int mode);
int cc_timer_set_mode_stop(cc_timer_t tim, int mode);
uint32_t cc_timer_get_systick();
void cc_timer_deinit(cc_timer_t tim);
void cc_timer_destory(cc_timer_t tim);

#endif